<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Class dynamic_type_dispatcher</title>
<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../../index.html" title="Chapter 1. Boost.Log v2">
<link rel="up" href="../../utilities.html#header.boost.log.utility.type_dispatch.dynamic_type_dispatcher_hpp" title="Header &lt;boost/log/utility/type_dispatch/dynamic_type_dispatcher.hpp&gt;">
<link rel="prev" href="../../BOOST_LOG_TIME_PE_idm40842.html" title="Macro BOOST_LOG_TIME_PERIOD_TYPES">
<link rel="next" href="integral_types.html" title="Type definition integral_types">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td></tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="../../BOOST_LOG_TIME_PE_idm40842.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../utilities.html#header.boost.log.utility.type_dispatch.dynamic_type_dispatcher_hpp"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="integral_types.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="refentry">
<a name="boost.log.dynamic_type_dispatcher"></a><div class="titlepage"></div>
<div class="refnamediv">
<h2><span class="refentrytitle">Class dynamic_type_dispatcher</span></h2>
<p>boost::log::dynamic_type_dispatcher — A dynamic type dispatcher. </p>
</div>
<h2 class="refsynopsisdiv-title">Synopsis</h2>
<div class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: &lt;<a class="link" href="../../utilities.html#header.boost.log.utility.type_dispatch.dynamic_type_dispatcher_hpp" title="Header &lt;boost/log/utility/type_dispatch/dynamic_type_dispatcher.hpp&gt;">boost/log/utility/type_dispatch/dynamic_type_dispatcher.hpp</a>&gt;

</span>
<span class="keyword">class</span> <a class="link" href="dynamic_type_dispatcher.html" title="Class dynamic_type_dispatcher">dynamic_type_dispatcher</a> <span class="special">:</span> <span class="keyword">public</span> <span class="identifier">type_dispatcher</span> <span class="special">{</span>
<span class="keyword">public</span><span class="special">:</span>
  <span class="comment">// <a class="link" href="dynamic_type_dispatcher.html#boost.log.dynamic_type_dispatcherconstruct-copy-destruct">construct/copy/destruct</a></span>
  <a class="link" href="dynamic_type_dispatcher.html#idm40875-bb"><span class="identifier">dynamic_type_dispatcher</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>
  <a class="link" href="dynamic_type_dispatcher.html#idm40878-bb"><span class="identifier">dynamic_type_dispatcher</span></a><span class="special">(</span><a class="link" href="dynamic_type_dispatcher.html" title="Class dynamic_type_dispatcher">dynamic_type_dispatcher</a> <span class="keyword">const</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
  <a class="link" href="dynamic_type_dispatcher.html" title="Class dynamic_type_dispatcher">dynamic_type_dispatcher</a> <span class="special">&amp;</span> <a class="link" href="dynamic_type_dispatcher.html#idm40884-bb"><span class="keyword">operator</span><span class="special">=</span></a><span class="special">(</span><a class="link" href="dynamic_type_dispatcher.html" title="Class dynamic_type_dispatcher">dynamic_type_dispatcher</a> <span class="keyword">const</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>

  <span class="comment">// <a class="link" href="dynamic_type_dispatcher.html#idm40857-bb">public member functions</a></span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">,</span> <span class="keyword">typename</span> VisitorT<span class="special">&gt;</span> <span class="keyword">void</span> <a class="link" href="dynamic_type_dispatcher.html#idm40858-bb"><span class="identifier">register_type</span></a><span class="special">(</span><span class="identifier">VisitorT</span> <span class="keyword">const</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
  <span class="identifier">dispatching_map</span><span class="special">::</span><span class="identifier">size_type</span> <a class="link" href="dynamic_type_dispatcher.html#idm40871-bb"><span class="identifier">registered_types_count</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
<span class="special">}</span><span class="special">;</span></pre></div>
<div class="refsect1">
<a name="idm98796"></a><h2>Description</h2>
<p>The type dispatcher can be used to pass objects of arbitrary types from one component to another. With regard to the library, the type dispatcher can be used to extract attribute values.</p>
<p>The dynamic type dispatcher can be initialized in run time and, therefore, can support different types, depending on runtime conditions. Each supported type is associated with a functional object that will be called when an object of the type is dispatched. </p>
<div class="refsect2">
<a name="idm98800"></a><h3>
<a name="boost.log.dynamic_type_dispatcherconstruct-copy-destruct"></a><code class="computeroutput">dynamic_type_dispatcher</code> 
        public
       construct/copy/destruct</h3>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem">
<pre class="literallayout"><a name="idm40875-bb"></a><span class="identifier">dynamic_type_dispatcher</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>
<p>Default constructor </p>
</li>
<li class="listitem">
<pre class="literallayout"><a name="idm40878-bb"></a><span class="identifier">dynamic_type_dispatcher</span><span class="special">(</span><a class="link" href="dynamic_type_dispatcher.html" title="Class dynamic_type_dispatcher">dynamic_type_dispatcher</a> <span class="keyword">const</span> <span class="special">&amp;</span> that<span class="special">)</span><span class="special">;</span></pre>
<p>Copy constructor </p>
</li>
<li class="listitem">
<pre class="literallayout"><a class="link" href="dynamic_type_dispatcher.html" title="Class dynamic_type_dispatcher">dynamic_type_dispatcher</a> <span class="special">&amp;</span> <a name="idm40884-bb"></a><span class="keyword">operator</span><span class="special">=</span><span class="special">(</span><a class="link" href="dynamic_type_dispatcher.html" title="Class dynamic_type_dispatcher">dynamic_type_dispatcher</a> <span class="keyword">const</span> <span class="special">&amp;</span> that<span class="special">)</span><span class="special">;</span></pre>
<p>Copy assignment </p>
</li>
</ol></div>
</div>
<div class="refsect2">
<a name="idm98841"></a><h3>
<a name="idm40857-bb"></a><code class="computeroutput">dynamic_type_dispatcher</code> public member functions</h3>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">,</span> <span class="keyword">typename</span> VisitorT<span class="special">&gt;</span> 
  <span class="keyword">void</span> <a name="idm40858-bb"></a><span class="identifier">register_type</span><span class="special">(</span><span class="identifier">VisitorT</span> <span class="keyword">const</span> <span class="special">&amp;</span> visitor<span class="special">)</span><span class="special">;</span></pre>
<p>The method registers a new type</p>
<p>
</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term">Parameters:</span></p></td>
<td><div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term"><code class="computeroutput">visitor</code></span></p></td>
<td><p>Function object that will be associated with the type <code class="computeroutput">T</code> </p></td>
</tr></tbody>
</table></div></td>
</tr></tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><span class="identifier">dispatching_map</span><span class="special">::</span><span class="identifier">size_type</span> <a name="idm40871-bb"></a><span class="identifier">registered_types_count</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>
<p>The method returns the number of registered types </p>
</li>
</ol></div>
</div>
</div>
</div>
<div class="copyright-footer">Copyright © 2007-2024 Andrey Semashev<p>
        Distributed under the Boost Software License, Version 1.0. (See accompanying
        file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>).
      </p>
</div>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="../../BOOST_LOG_TIME_PE_idm40842.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../utilities.html#header.boost.log.utility.type_dispatch.dynamic_type_dispatcher_hpp"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="integral_types.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
